From: Brion Vibber Date: Sun, 7 May 2006 07:26:25 +0000 (+0000) Subject: Fix that optional error return for EditFilter hook. X-Git-Tag: 1.31.0-rc.0~57217 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=a84303521297fbcf97117424ac65a4c04ca74352;p=lhc%2Fweb%2Fwiklou.git Fix that optional error return for EditFilter hook. Didn't work at all previously, with two entire ways to prevent the value being passed along. :) --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 3c46368d35..2f3d8c8bca 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -300,8 +300,8 @@ $user: the user who did the block (not the one being blocked) 'EditFilter': Perform checks on an edit $editor: Edit form (see includes/EditPage.php) $text: Contents of the edit box -§ion: Section being edited -$error: Error message to return +$section: Section being edited +&$error: Error message to return Return false to halt editing; you'll need to handle error messages, etc. yourself. Alternatively, modifying $error and returning true will cause the contents of $error diff --git a/includes/EditPage.php b/includes/EditPage.php index a708dd4e92..abb5e16f8d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -493,7 +493,7 @@ class EditPage { wfProfileOut( "$fname-checks" ); return false; } - if ( !wfRunHooks( 'EditFilter', array( &$this, $this->textbox1, $this->section, $this->hookError ) ) ) { + if ( !wfRunHooks( 'EditFilter', array( $this, $this->textbox1, $this->section, &$this->hookError ) ) ) { # Error messages etc. could be handled within the hook... wfProfileOut( $fname ); wfProfileOut( "$fname-checks" ); @@ -778,7 +778,7 @@ class EditPage { $wgOut->addWikiText( wfMsg( 'missingsummary' ) ); } - if( !$this->hookError = '' ) { + if( !$this->hookError == '' ) { $wgOut->addWikiText( $this->hookError ); }